package com.google.code.opencode.action;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Required;

import com.google.code.opencode.service.TwitterUpdater;
import com.opensymphony.xwork2.ActionSupport;

/**
 * @author Cesar Arevalo
 * @since 0.0.1
 */
public class Sender extends ActionSupport {

	private static final long serialVersionUID = 9049417153102800529L;
	private static Logger logger = LoggerFactory.getLogger(Sender.class);

	private TwitterUpdater twitterUpdater;

	public String execute() {
		logger.debug("About to send the information to the twitter account.");

		return ( twitterUpdater.sendUpdate() ? SUCCESS : ERROR );
	}

	@Required
	public void setTwitterUpdater(TwitterUpdater twitteUpdater) {
		this.twitterUpdater = twitteUpdater;
	}

}
